{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Complete Case Analysis\n",
    "\n",
    "\n",
    "Complete-case analysis (CCA), also called list-wise deletion of cases, consists in simply **discarding** observations where values in any of the variables are missing. Complete Case Analysis means literally analysing only those observations for which there is information in **all** of the variables (Xs). \n",
    "\n",
    "CCA can be applied to both categorical and numerical variables.\n",
    "\n",
    "\n",
    "### Assumptions\n",
    "\n",
    "CCA works well when the data are missing completely at random (MCAR). In this case, excluding observations with missing data would be the same as randomly excluding some observations from the dataset, given that the missing data are totally at random. \n",
    "\n",
    "### Advantages\n",
    "\n",
    "- Easy to implement\n",
    "- The same set of data (albeit a reduced set) is used for all analyses (no data manipulation)\n",
    "- Preserves variable distribution (if data is MCAR, then the distribution of the variables of the reduced dataset should match the distribution in the original dataset)\n",
    "\n",
    "### Disadvantages\n",
    "\n",
    "-  It can exclude a large fraction of the original sample, which are potentially informative for the analysis\n",
    "-  CCA will be biased if the complete cases systematically differ from the original sample (e.g. when the missing information is in fact MAR or NMAR: not missing at random).\n",
    "\n",
    "\n",
    "In practice, CCA may be an acceptable method when the amount of missing information is small. Unfortunately, there is no rule of thumb to determine how much missing data is small or negligible.\n",
    "\n",
    "In many real life datasets, the amount of missing data is never small, and therefore CCA is typically never an option. \n",
    "\n",
    "=============================================================================\n",
    "\n",
    "For building machine learning models, I would recommend replacing missing values by any of the methods that I will show in future lectures. However, for a quick analysis, if the amount of missing values is not big, this could be the easiest and fastest approach."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "===============================================================================\n",
    "\n",
    "## Real Life example: \n",
    "\n",
    "### Predicting Survival on the Titanic: understanding society behaviour and beliefs\n",
    "\n",
    "Perhaps one of the most infamous shipwrecks in history, the Titanic sank after colliding with an iceberg, killing 1502 out of 2224 people on board. Interestingly, by analysing the probability of survival based on few attributes like gender, age, and social status, we can make very accurate predictions on which passengers would survive. Some groups of people were more likely to survive than others, such as women, children, and the upper-class. Therefore, we can learn about the society priorities and privileges at the time.\n",
    "\n",
    "### Predicting Sale Price of Houses\n",
    "\n",
    "The problem at hand aims to predict the final sale price of homes based on different explanatory variables describing aspects of residential homes. Predicting house prices is useful to identify fruitful investments, or to determine whether the price advertised for a house is over or underestimated, before making a buying judgment.\n",
    "\n",
    "=====================================================================================\n",
    "\n",
    "In the following cells, I will demonstrate the consequences of complete case analysis on the Titanic and House Price datasets from Kaggle.\n",
    "\n",
    "If you haven't downloaded the datasets yet, in the lecture \"Guide to setting up your computer\" in section 1, you can find the details on how to do so.\n",
    "\n",
    "\n",
    "## Titanic dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "% matplotlib inline\n",
    "\n",
    "pd.set_option('display.max_columns', None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PassengerId    0.000000\n",
       "Survived       0.000000\n",
       "Pclass         0.000000\n",
       "Name           0.000000\n",
       "Sex            0.000000\n",
       "Age            0.198653\n",
       "SibSp          0.000000\n",
       "Parch          0.000000\n",
       "Ticket         0.000000\n",
       "Fare           0.000000\n",
       "Cabin          0.771044\n",
       "Embarked       0.002245\n",
       "dtype: float64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# let's load the dataset and check the percentage of missing values per variable\n",
    "\n",
    "data = pd.read_csv('titanic.csv')\n",
    "data.isnull().mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Assuming that the missing values are totally at random (which are not if you remember from the \"Missing Values\" lecture in section 3), if we chose to remove all the missing observations, we would end up with a very small dataset, given that Cabin is missing for 77% of the observations. See below."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total passengers with values in all variables:  183\n",
      "total passengers in the Titanic:  891\n",
      "percentage of data without missing values:  0.2053872053872054\n"
     ]
    }
   ],
   "source": [
    "# let's go ahead and have a look at how many observations we would drop\n",
    "print('total passengers with values in all variables: ', data.dropna().shape[0])\n",
    "print('total passengers in the Titanic: ', data.shape[0])\n",
    "print('percentage of data without missing values: ', data.dropna().shape[0]/ np.float(data.shape[0]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In fact, we have complete information for only 20% of our observations in the Titanic dataset. Thus, CCA would not be an option for this dataset.\n",
    "\n",
    "We could however choose to replace the missing values in the variables Age and Cabin by an appropriate method (as I will show in the next lectures), and remove the observations where Embarked is missing. That would be removing only 2 observations from the entire dataset. See below."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>62</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Icard, Miss. Amelie</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113572</td>\n",
       "      <td>80.0</td>\n",
       "      <td>B28</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>829</th>\n",
       "      <td>830</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Stone, Mrs. George Nelson (Martha Evelyn)</td>\n",
       "      <td>female</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>113572</td>\n",
       "      <td>80.0</td>\n",
       "      <td>B28</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     PassengerId  Survived  Pclass                                       Name  \\\n",
       "61            62         1       1                        Icard, Miss. Amelie   \n",
       "829          830         1       1  Stone, Mrs. George Nelson (Martha Evelyn)   \n",
       "\n",
       "        Sex   Age  SibSp  Parch  Ticket  Fare Cabin Embarked  \n",
       "61   female  38.0      0      0  113572  80.0   B28      NaN  \n",
       "829  female  62.0      0      0  113572  80.0   B28      NaN  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# only 2 passengers contain missing data for Embarked. We could safely remove them.\n",
    "\n",
    "data[data.Embarked.isnull()]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Distribution of the dataset after CCA\n",
    "\n",
    "If we remove the missing observations, because they are not missing completely at random, the new dataset containing the people for whom all the data is available, will be quite different from the original group. See below:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x79987a06d8>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAA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ntMNA9vb7D9XEsdupSfZ1kg4gSxo3RsStqXirpLFp+1hgW1XxtcnpwHmSuskuV54p6Zt0\nXjv02gRsioj70/rNZImk09rjA8DGiHg+Il4DbgVOo/Paoa/+vn/h39Ohmjg6emoSSSK7jv1ERHy1\nZdNKYFZangXc3u7Y2ikiFkTE+IiYSPbfwP+JiIvpsHboFRHPAc9KmpKKzgLW0Xnt8XPgPZIOSf9W\nziK7D9hp7dBXf99/JTBT0oGSJgGTgdUDHWjIPgAo6UNk17d7pyZZVHFIbSPpfcCPgMdoXtu/guw+\nxwrgSOAZ4MKI6HuDbJ8kqQuYFxHnSvodOrcdppENFHgL8DTwCbL/Qeyo9pD0FeAPyEYgPgz8ETCC\nDmkHSTcBXWQzAm8FrgS+Qz/fX9J/Az5J1l6fjYjvDnj8oZo4zMysGkP1UpWZmVXEicPMzApx4jAz\ns0KcOMzMrBAnDjMzK6R2L3IyqztJO8mGQvc6PyK6KwrHrO08HNesIEk9ETFiD+rtHxE7yojJrJ18\nqcpsEEiaKOlHkh5Kn9NSeVcqX0n2FDeSLpa0WtIjkr6+uymszerGicOsuIPTj/4jkm5LZduAD0bE\nSWRPLP99y/4nAXMj4mhJv5e2nx4R04CdwEXtDN5sb/keh1lxv0k/+q0OAL6WpvzYCRzdsm11es8B\nZPMmnQw8kE2jxMF03mR7NsQ5cZgNjs+RzQl0AllP/tWWba+0LAtYFhEL2hib2aDypSqzwfE2YEtE\nvA5cQjb55q6sAj4q6XB44z3Qv9umGM0GhROH2eC4Bpgl6WfAMby5l/GGiFgHfAH4gaRHgbuBsW2L\n0mwQeDiumZkV4h6HmZkV4sRhZmaFOHGYmVkhThxmZlaIE4eZmRXixGFmZoU4cZiZWSFOHGZmVsj/\nB78aioUS0Gq2AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7998416080>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "## the following assumes CCA only for the variable Age\n",
    "# I will plot the distribution of Fare\n",
    "\n",
    "fig = plt.figure()\n",
    "ax = fig.add_subplot(111)\n",
    "data.Fare.hist(bins=50, ax=ax) # histogram original dataset\n",
    "data.dropna(axis=0, subset=['Age'])['Fare'].hist(bins=50, ax=ax, color='red') # histogram cca on Age\n",
    "ax.set_xlim(0,100)\n",
    "ax.set_xlabel('Fare')\n",
    "ax.set_ylabel('Number of Passengers')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Comparing the red and blue histograms we can observe that the distribution of the entire dataset do not match that one of the dataset after CCA. There are a lot of people for whom Age is missing, that paid lower fares to get on the titanic."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x7998a56a90>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEKCAYAAAAIO8L1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGZ1JREFUeJzt3X2wJXV95/H3hwGfGHRA9O4EMKASXMDHmSWKlstoEic+\nAGspi4UuWpSju6whm5gIlk8pQ6JRU0YNSYhY4qLOjvgAUR4k44y4MYCMgjwocQQUZhEUQbloUPC7\nf5y+ehz63ttnZvqcy533q+rU7f6d7j6fc2jOd/r8un+dqkKSpK3tMukAkqSFyQIhSWplgZAktbJA\nSJJaWSAkSa0sEJKkVhYISVIrC4QkqZUFQpLUatdJB9gee++9d+2///7bvP7dd9/N7rvvvuMC7SDm\nGo25RmOu0SzGXJs2bfpBVT1q3gWr6gH7WLFiRW2PDRs2bNf6fTHXaMw1GnONZjHmAi6vDt+x/sQk\nSWrVa4FIcmOSq5JckeTypm2vJBcl+Vbzd8+h5U9JsjnJdUme12c2SdLcxnEEsaqqnlJVK5v5k4H1\nVXUgsL6ZJ8nBwLHAIcBq4LQkS8aQT5LUYhI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mCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7998409ef0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "## the following assumes CCA only for the variable Age\n",
    "# I will plot the distribution of Class\n",
    "\n",
    "fig = plt.figure()\n",
    "ax = fig.add_subplot(111)\n",
    "data.Pclass.hist(bins=50, ax=ax)\n",
    "data.dropna(axis=0, subset=['Age'])['Pclass'].hist(bins=50, ax=ax, color='red')\n",
    "ax.set_xlabel('Pclass')\n",
    "ax.set_ylabel('Number of Passengers')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Similarly, the original dataset shows a higher proportion of people that travelled n class 3. In other words, the dataset contains less missing Age values for people travelling in Class 3. \n",
    "\n",
    "Given that the distribution of the variables between the original dataset and that one after CCA are not equivalent, CCA is not a good option. Our conclusions would be biased towards the population with complete observations. \n",
    "\n",
    "\n",
    "### House Sale Dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>variable</th>\n",
       "      <th>na_percentage</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Id</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>MSSubClass</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>MSZoning</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>LotFrontage</td>\n",
       "      <td>0.177397</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>LotArea</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      variable  na_percentage\n",
       "0           Id       0.000000\n",
       "1   MSSubClass       0.000000\n",
       "2     MSZoning       0.000000\n",
       "3  LotFrontage       0.177397\n",
       "4      LotArea       0.000000"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# let's load the House Sale Price dataset with a few columns and calculate the percentage of missing values\n",
    "\n",
    "data = pd.read_csv('houseprice.csv')\n",
    "\n",
    "# make a dataframe with the missing values per variable\n",
    "data_na = data.isnull().mean()\n",
    "data_na = pd.DataFrame(data_na.reset_index())\n",
    "data_na.columns = ['variable', 'na_percentage']\n",
    "data_na.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>variable</th>\n",
       "      <th>na_percentage</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>LotFrontage</td>\n",
       "      <td>0.177397</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Alley</td>\n",
       "      <td>0.937671</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>MasVnrType</td>\n",
       "      <td>0.005479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>MasVnrArea</td>\n",
       "      <td>0.005479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>BsmtQual</td>\n",
       "      <td>0.025342</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       variable  na_percentage\n",
       "3   LotFrontage       0.177397\n",
       "6         Alley       0.937671\n",
       "25   MasVnrType       0.005479\n",
       "26   MasVnrArea       0.005479\n",
       "30     BsmtQual       0.025342"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# let's select those columns where there are missing values\n",
    "data_na[data_na.na_percentage!=0].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total number of columns:  81\n",
      "columns with NA:  19\n",
      "total observations with complete data:  0\n"
     ]
    }
   ],
   "source": [
    "print('total number of columns: ', data_na.shape[0])\n",
    "print('columns with NA: ', data_na[data_na.na_percentage!=0].shape[0])\n",
    "print('total observations with complete data: ', data.dropna().shape[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Approximately 25 % of the columns contain missing data, and in fact, no observation in the dataset contains no NA in any of the columns. So Complete Case Analysis is not an option. This is probably due to the fact that some columns like Alley are practically empty (contain only NA). See below."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x79983da2b0>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iV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7PZZptx0003LfD57LPPZoMNNmDbbbflkEMO4fzzzwfg\n+eefZ7fddmPEiBF88pOf5Omnn058xPOFQl4PbA+sZmYzgDOB3gDuPgYYTwiDnEYIhTwiuZdCiKWe\n5557juuvv54rrriCgw46iBtuuIH99tuPo446CoAzzjiDK6+8khNPPLFdG9OnT+fhhx/m+eefZ4cd\ndmDatGlcc801rLjiikycOJEPPviAbbbZhl122QWARx55hCeeeILBgwczdepUzjnnHB544AFWW201\n/vGPECdy0kkn8Y1vfINtt92Wl19+mV133ZWnnnoKgKeffpq7776bWbNmscEGG3Dsscdy7rnn8sQT\nT/Doo48C4angd7/7Hf369eONN95gq622Yu+992bSpEnccMMNTJkyhblz5zJ8+HBGjBgBwNFHH82Y\nMWMYMmQIDz30EMcddxx33XVX0uPdqbi7+yGdfO7A8ck8EkLUksGDB7P55psDMGLECKZPn84TTzzB\nGWecwVtvvcXs2bPZddddO7Rx0EEH0aNHD4YMGcK6667L008/ze23385jjz3Gb37zGwDefvttnnvu\nOZZZZhlGjx69IE78rrvu4sADD2S11VYDYJVVVgHgjjvu4Mknn1zwP9555x1mz54NwB577EGfPn3o\n06cPq6++Oq+99tpiPrk7p512Gvfeey89evTg1Vdf5bXXXuP+++9nn332oW/fvvTt25e99toLgNmz\nZ/PAAw9w4IEHLrDxwQcflDqmHaEZqkKIJUKfPn0WvO/Zsyfvv/8+hx9+ODfeeCPDhg1j7NixTJgw\noUMbzeGBZoa7c9FFFy12Y5gwYQLLLbdcp37Nnz+fBx98kL59+3bq87x58xbb5tprr2XmzJlMnjyZ\n3r17M2jQoA7j0+fPn89KK620oOXfVSi3jBCi25g1axZrrrkmc+fO5dprr+10+3HjxjF//nyef/55\nXnjhBTbYYAN23XVXLrvsMubOnQvAs88+y7vvvrvYvjvuuCPjxo3jzTffBFjQLbPLLrtw0UUXLdiu\nM9FdYYUVmDVr1oLlt99+m9VXX53evXtz991389JLISPvNttswy233MKcOXOYPXv2gjGCfv36MXjw\nYMaNGweElv+UKV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8/jevvNLPF6r2a2Qgzuyfuf5uZrdm131yI\ntpG4i7rwa+CgzPJBwC+AfWPe8R2AH8eWOsAQ4FJ338TdX2qy9WV3HwGMBL5mZqvG9csBk9x9E+Ae\n4MzsTmbWG7gIOCDufxXw/WTfUIgCqFtG1AJ3/4uZrW5mHwP6A/8E/g781My2I0wOWgtYI+7yUmP2\nZxt8zcz2je/XJtwI3ow2fh3X/y/w26b9NiCUXvtjvIf0BP5W9bsJUQaJu6gT44ADgI8SRPgLBKEf\n4e5zzWw6C2dWvtuWATPbHvg0sLW7v2dmE2h/NmbzJBEjpB3eusJ3ECIJ6pYRdeLXwMEEgR9HSL71\nehT2HYB1cthYEfhnFPYNgWwt1h7RNoRc6/c17fsM0N/MtobQTWNmmyBENyBxF7XB3acSStG96u5/\nA64FRprZ48ChQJ7kW38AepnZU4TUu9mum3eB0Wb2BLAj8L2m//8vgvj/0MymAI8Cn6j2rYQoh9IP\nCCFEDVHLXQghaojEXQghaojEXQghaojEXQghaojEXQghaojEXQghaojEXQghaojEXQghasj/BySs\njx2058L2AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x79983daf28>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data_na.index = data_na['variable']\n",
    "data_na[data_na.na_percentage!=0].sort_values(by='na_percentage', ascending=False).plot.bar()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We see in this plot that there are a few variables in which the percentage of missing values is very small (<5%). If we were to study only those variables, or build machine learning models with only those variables, perhaps removing the observations with missing values wouldn't cause to much of a set-back.\n",
    "\n",
    "However, there are 4 variables for which most of the values are missing. Therefore CCA is not an option on the entire dataset. \n",
    "\n",
    "The debate would be whether those variables with > 90% NA are informative at all. That is something that we would know by investigating the relationship of those variables with the target, in this case, SalePrice."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Id</th>\n",
       "      <th>MSSubClass</th>\n",
       "      <th>MSZoning</th>\n",
       "      <th>LotFrontage</th>\n",
       "      <th>LotArea</th>\n",
       "      <th>Street</th>\n",
       "      <th>Alley</th>\n",
       "      <th>LotShape</th>\n",
       "      <th>LandContour</th>\n",
       "      <th>Utilities</th>\n",
       "      <th>LotConfig</th>\n",
       "      <th>LandSlope</th>\n",
       "      <th>Neighborhood</th>\n",
       "      <th>Condition1</th>\n",
       "      <th>Condition2</th>\n",
       "      <th>BldgType</th>\n",
       "      <th>HouseStyle</th>\n",
       "      <th>OverallQual</th>\n",
       "      <th>OverallCond</th>\n",
       "      <th>YearBuilt</th>\n",
       "      <th>YearRemodAdd</th>\n",
       "      <th>RoofStyle</th>\n",
       "      <th>RoofMatl</th>\n",
       "      <th>Exterior1st</th>\n",
       "      <th>Exterior2nd</th>\n",
       "      <th>MasVnrType</th>\n",
       "      <th>MasVnrArea</th>\n",
       "      <th>ExterQual</th>\n",
       "      <th>ExterCond</th>\n",
       "      <th>Foundation</th>\n",
       "      <th>BsmtQual</th>\n",
       "      <th>BsmtCond</th>\n",
       "      <th>BsmtExposure</th>\n",
       "      <th>BsmtFinType1</th>\n",
       "      <th>BsmtFinSF1</th>\n",
       "      <th>BsmtFinType2</th>\n",
       "      <th>BsmtFinSF2</th>\n",
       "      <th>BsmtUnfSF</th>\n",
       "      <th>TotalBsmtSF</th>\n",
       "      <th>Heating</th>\n",
       "      <th>HeatingQC</th>\n",
       "      <th>CentralAir</th>\n",
       "      <th>Electrical</th>\n",
       "      <th>1stFlrSF</th>\n",
       "      <th>2ndFlrSF</th>\n",
       "      <th>LowQualFinSF</th>\n",
       "      <th>GrLivArea</th>\n",
       "      <th>BsmtFullBath</th>\n",
       "      <th>BsmtHalfBath</th>\n",
       "      <th>FullBath</th>\n",
       "      <th>HalfBath</th>\n",
       "      <th>BedroomAbvGr</th>\n",
       "      <th>KitchenAbvGr</th>\n",
       "      <th>KitchenQual</th>\n",
       "      <th>TotRmsAbvGrd</th>\n",
       "      <th>Functional</th>\n",
       "      <th>Fireplaces</th>\n",
       "      <th>FireplaceQu</th>\n",
       "      <th>GarageType</th>\n",
       "      <th>GarageYrBlt</th>\n",
       "      <th>GarageFinish</th>\n",
       "      <th>GarageCars</th>\n",
       "      <th>GarageArea</th>\n",
       "      <th>GarageQual</th>\n",
       "      <th>GarageCond</th>\n",
       "      <th>PavedDrive</th>\n",
       "      <th>WoodDeckSF</th>\n",
       "      <th>OpenPorchSF</th>\n",
       "      <th>EnclosedPorch</th>\n",
       "      <th>3SsnPorch</th>\n",
       "      <th>ScreenPorch</th>\n",
       "      <th>PoolArea</th>\n",
       "      <th>PoolQC</th>\n",
       "      <th>Fence</th>\n",
       "      <th>MiscFeature</th>\n",
       "      <th>MiscVal</th>\n",
       "      <th>MoSold</th>\n",
       "      <th>YrSold</th>\n",
       "      <th>SaleType</th>\n",
       "      <th>SaleCondition</th>\n",
       "      <th>SalePrice</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1379</th>\n",
       "      <td>1380</td>\n",
       "      <td>80</td>\n",
       "      <td>RL</td>\n",
       "      <td>73.0</td>\n",
       "      <td>9735</td>\n",
       "      <td>Pave</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Reg</td>\n",
       "      <td>Lvl</td>\n",
       "      <td>AllPub</td>\n",
       "      <td>Inside</td>\n",
       "      <td>Gtl</td>\n",
       "      <td>Timber</td>\n",
       "      <td>Norm</td>\n",
       "      <td>Norm</td>\n",
       "      <td>1Fam</td>\n",
       "      <td>SLvl</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>2006</td>\n",
       "      <td>2007</td>\n",
       "      <td>Gable</td>\n",
       "      <td>CompShg</td>\n",
       "      <td>VinylSd</td>\n",
       "      <td>VinylSd</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>TA</td>\n",
       "      <td>TA</td>\n",
       "      <td>PConc</td>\n",
       "      <td>Gd</td>\n",
       "      <td>TA</td>\n",
       "      <td>No</td>\n",
       "      <td>Unf</td>\n",
       "      <td>0</td>\n",
       "      <td>Unf</td>\n",
       "      <td>0</td>\n",
       "      <td>384</td>\n",
       "      <td>384</td>\n",
       "      <td>GasA</td>\n",
       "      <td>Gd</td>\n",
       "      <td>Y</td>\n",
       "      <td>NaN</td>\n",
       "      <td>754</td>\n",
       "      <td>640</td>\n",
       "      <td>0</td>\n",
       "      <td>1394</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>Gd</td>\n",
       "      <td>7</td>\n",
       "      <td>Typ</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>BuiltIn</td>\n",
       "      <td>2007.0</td>\n",
       "      <td>Fin</td>\n",
       "      <td>2</td>\n",
       "      <td>400</td>\n",
       "      <td>TA</td>\n",
       "      <td>TA</td>\n",
       "      <td>Y</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>2008</td>\n",
       "      <td>WD</td>\n",
       "      <td>Normal</td>\n",
       "      <td>167500</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        Id  MSSubClass MSZoning  LotFrontage  LotArea Street Alley LotShape  \\\n",
       "1379  1380          80       RL         73.0     9735   Pave   NaN      Reg   \n",
       "\n",
       "     LandContour Utilities LotConfig LandSlope Neighborhood Condition1  \\\n",
       "1379         Lvl    AllPub    Inside       Gtl       Timber       Norm   \n",
       "\n",
       "     Condition2 BldgType HouseStyle  OverallQual  OverallCond  YearBuilt  \\\n",
       "1379       Norm     1Fam       SLvl            5            5       2006   \n",
       "\n",
       "      YearRemodAdd RoofStyle RoofMatl Exterior1st Exterior2nd MasVnrType  \\\n",
       "1379          2007     Gable  CompShg     VinylSd     VinylSd       None   \n",
       "\n",
       "      MasVnrArea ExterQual ExterCond Foundation BsmtQual BsmtCond  \\\n",
       "1379         0.0        TA        TA      PConc       Gd       TA   \n",
       "\n",
       "     BsmtExposure BsmtFinType1  BsmtFinSF1 BsmtFinType2  BsmtFinSF2  \\\n",
       "1379           No          Unf           0          Unf           0   \n",
       "\n",
       "      BsmtUnfSF  TotalBsmtSF Heating HeatingQC CentralAir Electrical  \\\n",
       "1379        384          384    GasA        Gd          Y        NaN   \n",
       "\n",
       "      1stFlrSF  2ndFlrSF  LowQualFinSF  GrLivArea  BsmtFullBath  BsmtHalfBath  \\\n",
       "1379       754       640             0       1394             0             0   \n",
       "\n",
       "      FullBath  HalfBath  BedroomAbvGr  KitchenAbvGr KitchenQual  \\\n",
       "1379         2         1             3             1          Gd   \n",
       "\n",
       "      TotRmsAbvGrd Functional  Fireplaces FireplaceQu GarageType  GarageYrBlt  \\\n",
       "1379             7        Typ           0         NaN    BuiltIn       2007.0   \n",
       "\n",
       "     GarageFinish  GarageCars  GarageArea GarageQual GarageCond PavedDrive  \\\n",
       "1379          Fin           2         400         TA         TA          Y   \n",
       "\n",
       "      WoodDeckSF  OpenPorchSF  EnclosedPorch  3SsnPorch  ScreenPorch  \\\n",
       "1379         100            0              0          0            0   \n",
       "\n",
       "      PoolArea PoolQC Fence MiscFeature  MiscVal  MoSold  YrSold SaleType  \\\n",
       "1379         0    NaN   NaN         NaN        0       5    2008       WD   \n",
       "\n",
       "     SaleCondition  SalePrice  \n",
       "1379        Normal     167500  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Let's look at another variable\n",
    "# there is only one missing value for this variable, so we could potentially remove it\n",
    "data[data.Electrical.isnull()]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Conclusion\n",
    "\n",
    "In datasets with many variables that contain missing data, CCA will typically not be an option as it will render a reduced dataset with complete observations. However, if only a subset of the variables from the dataset will be used, we could evaluate variable by variable, whether we choose to discard values with NA, or to replace them with other methods.\n",
    "\n",
    "**That is all for this demonstration. I hope you enjoyed the notebook, and see you in the next one.**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  },
  "toc": {
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": "block",
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
